<?php
/**
 * 更新数据结构
 **/
$biaoming = 'fankui';
$prefix = \Phpcmf\Service::M()->prefix;
$table = $prefix.'1_'.$biaoming;
$rows = \Phpcmf\Service::M('Module')->table($prefix.'module')->where('dirname', $biaoming)->getRow();
 //添加图集
 if (\Phpcmf\Service::M()->db->tableExists($table) && !\Phpcmf\Service::M()->db->fieldExists('tuji', $table)) {
     \Phpcmf\Service::M()->query('ALTER TABLE `'.$table.'` ADD `tuji` text COLLATE utf8mb4_unicode_ci COMMENT \'图集\'');
 }
 $tujidata = \Phpcmf\Service::M()->table($prefix.'field')->where('relatedname', 'module')->where('relatedid', $rows['id'])->where('fieldname', 'tuji')->counts();
 if (!$tujidata) {
	 \Phpcmf\Service::M()->db->table('field')->insert(array(
	 'name' => '图集',
	 'fieldname' => 'tuji',
	 'fieldtype' => 'Filesjiugetu',
	 'relatedid' => $rows['id'],
	 'relatedname' => 'module',
	 'isedit' => '1',
	 'ismain' => '1',
	 'issystem' => '0',
	 'ismember' => '1',
	 'issearch' => '0',
	 'disabled' => '0',
	 'setting' => 
	 dr_array2string(array (
	   'option' => 
	   array (
		 'size' => '10',
		 'count' => '30',
		 'ext' => 'jpg,gif,png',
		 'attachment' => '0',
		 'image_reduce' => '',
		 'is_ext_tips' => '0',
		 'css' => '',
	   ),
	   'validate' => 
	   array (
		 'xss' => '1',
		 'required' => '0',
		 'pattern' => '',
		 'errortips' => '',
		 'check' => '',
		 'filter' => '',
		 'tips' => '',
		 'formattr' => '',
	   ),
	   'is_right' => '0',
	 )),
	 'displayorder' => '10',
	 ));
 }